<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
  $(function() {
      var rcrt_num;
      $("#rcrt_select").change(function() {
          rcrt_num = $(this).val();
          console.log(rcrt_num);
      });
  
    $("#searchbtn").click(function() {
      
        var app_nm = $("#app_nm").val();
        $("#app_nm").attr('value', app_nm);
        console.log(app_nm);
            
        var app_stat_yn = $("#app_stat_yn").is(':checked');
        console.log(app_stat_yn);
        location.href = "app_search.do?app_nm=" + app_nm + "&app_stat=" + app_stat_yn + "&rcrt_num=" + rcrt_num;
    });
    
    $("#pass_btn").click(function() { 
        var arr = $('input[name=pass_ck]:checked').serializeArray().map(function(item) { return item.value });
        alert("지원번호" + arr + "를 합격처리 합니다.");
        
       /*  $("input[name='item[]']:checkbox:checked").each(function(){items.push($(this).val());});
          */      
        
        location.href = "admin_evaluation.do?pass_list=" + arr;
        /* document.pass_list.submit(); */
    });
    
  });
</script>


<div id="content_work">
  <!-- 컨텐츠 -->
  <div class="work_contents3">
    <h1>
      <img src="images/newcomer/re_search_evulate.gif" alt="지원자조회및평가">
    </h1>
    <br>
    <table style="border: 1px solid #320c43; padding: 2px;"width="710">
      <tr> 
        <td align="left">
          채용공고 :
        </td>
        <td colspan="2">
          <select name="rcrt_select" class="select_bx01" id="rcrt_select" 
                   style="height: 23px; border: 1px solid #320c43; z-index: 20; background-color: #FAF7FF; width:465px;">
              <option value ="all" selected="selected">선택해 주세요</option>
              <c:forEach var="rcrt" items="${rcrt_list}">
              <option value="${rcrt.rcrt_num }">${rcrt.recruit_nm }</option>
              </c:forEach>
          </select>   
         </td>
      </tr>
      <tr>
         <td align="left">   
            지원자이름 : 
         </td>
         <td>
            <input type="text" id="app_nm" name="app_nm" 
                  style="height: 21px; border: 1px solid #320c43; background-color: #FAF7FF;">
            &nbsp;
            합격자 : <input type="checkbox" name="app_stat_yn" id="app_stat_yn" class="app_stat_yn">
            <!-- <input type="hidden" id="app_stat" name="app_stat" class="app_stat"> -->
         </td> 
         <td align="right">
          <input type="button" id="searchbtn" value="검색" 
                 style="height: 23px; border: 1px solid #320c43; background-color: #FAF7FF;
                 padding: 0 10px 0 8px; line-height: 23px;">
         </td>
      </tr>
    </table> 
    <br>
    <button id="pass_btn" class="pass_btn" style="height: 23px; border: 1px solid #320c43; z-index: 20; background-color: #FAF7FF;
            padding: 0 10px 0 8px; line-height: 23px;" >서류합격처리</button>
    <table class="tbl_type ma_b25 ma_t27" border="0" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>합격체크</th>
          <th>지원번호</th>
          <th>지원자이름</th>
          <th>Email</th>
          <th>지원상태</th>
          <th>채용공고</th>
          <th>지원일시</th>
        </tr>
      </thead>
      <tbody>

        <c:forEach var="app_list" items="${list}">
          <tr>
            <td class="td_t_bo td_b_bo td_l_bo2" align="center">
              <input type="checkbox" name="pass_ck" value="${app_list.app_num }">
            </td>
            <td class="td_t_bo td_b_bo al_l pd_l10">${app_list.app_num }</td>
            <td class="td_t_bo td_b_bo"><a href="admin_app_detail.do?app_num=${app_list.app_num }" title="app_detail" class='example1demo'>${app_list.app_nm }</a></td>
            <td class="td_t_bo td_b_bo">${app_list.email }</td>
            <td class="td_t_bo td_b_bo">${app_list.app_stat }</td>
            <c:choose>
                <c:when test="${fn:length(app_list.recruit_nm) > 20}">
                     <td class="td_t_bo td_b_bo"><c:out value="${fn:substring(app_list.recruit_nm,0,19)}" />...</td>
                </c:when>
                <c:otherwise>
                     <td class="td_t_bo td_b_bo"><c:out value="${app_list.recruit_nm}" /></td>
                </c:otherwise>
            </c:choose>
            <td class="td_t_bo td_b_bo">${app_list.reg_dt }</td>
          </tr>
        </c:forEach>
      </tbody>
    </table>
    <table width="710">
      <tr>
        <td align="center">
          <!-- 처음 이전 링크 --> <c:if test="${map.pg!=1}">  
         [<a href="admin_app_list.do?pg=1">◀◀</a>]
         [<a href="admin_app_list.do?pg=${map.pg-1}">◀</a>]      
      </c:if> <!-- 블록 범위 찍기 --> <c:forEach begin="${map.fromPage}" end="${map.toPage}" var="i">
            <c:if test="${i==map.pg}">[${i}]</c:if>
            <c:if test="${i!=map.pg}">
            [<a href="admin_app_list.do?pg=${i}">${i}</a>]
         </c:if>
          </c:forEach> <!-- 다음, 이후 --> <c:if test="${map.pg!=map.allPage}">  
         [<a href="admin_app_list.do?pg=${map.toPage}">▶▶</a>]
         [<a href="admin_app_list.do?pg=${map.pg+1}">▶</a>]      
      </c:if>
        </td>
      </tr>
    </table>
  </div>
  <!-- 컨텐츠 -->
</div>